package org.oslims.domain;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;

import com.google.gwt.validation.client.NotEmpty;

@Entity
public class Parameter extends AbstractBaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1851503721535147530L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;

	@NotEmpty
	@Column(unique = true)
	private String name;

	private String unit;

	@ManyToMany(mappedBy = "determinedParameters", targetEntity = Analysis.class)
	private List<Analysis> analysis = new ArrayList<Analysis>();

	@NotEmpty
	private String type;

	@OneToMany(mappedBy = "parameter")
	private List<ParameterResult> parameterResults = new ArrayList<ParameterResult>();

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	public List<Analysis> getAnalysis() {
		return analysis;
	}

	public void setAnalysis(List<Analysis> analysis) {
		this.analysis = analysis;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public void setParameterResults(List<ParameterResult> parameterResults) {
		this.parameterResults = parameterResults;
	}

	public List<ParameterResult> getParameterResults() {
		return parameterResults;
	}

	public String toString() {
		return this.name;
	}

}
